package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.MouldBoardMsg;
import cn.stylefeng.guns.sys.modular.system.service.MouldBoardMsgService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;
import java.util.List;


@Controller
@RequestMapping("/mouldBoardMsg")
public class MouldBoardMsgController extends BaseController {
    private String PREFIX = "/modular/system/project/";

    @Autowired
    private MouldBoardMsgService mouldBoardMsgService;

    /**
     * 新增内容
     *
     * @author fengshuonan
     * @Date 2018/12/23 4:57 PM
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public ResponseData add(@RequestBody String mouldBoardMsg) throws ParseException {
        List<MouldBoardMsg> list = JSON.parseArray(mouldBoardMsg, MouldBoardMsg.class);
        return this.mouldBoardMsgService.addMouldBoardMsg(list);
    }
    /**
     * 新增内容
     *
     * @author fengshuonan
     * @Date 2018/12/23 4:57 PM
     */
    @RequestMapping(value = "/addAdmin")
    @ResponseBody
    public ResponseData addAdmin(@RequestBody String mouldBoardMsg) {
        List<MouldBoardMsg> list = JSON.parseArray(mouldBoardMsg, MouldBoardMsg.class);
        return this.mouldBoardMsgService.addMouldBoardMsgAdmin(list);
    }

    /**
     * 商务条件查询
     * @return
     */
    @RequestMapping("/shangwu")
    public String shangwu(){
        return PREFIX+"shangwu.html";
    }

    @RequestMapping("/listDataShangwu")
    @ResponseBody
    public LayuiPageInfo listDataShangwu(MouldBoardMsg param){
        return mouldBoardMsgService.listDataShangwu(param);
    }

    /**
     * 工程条件查询
     * @return
     */
    @RequestMapping("/gongcheng")
    public String gongcheng(){
        return PREFIX+"gongcheng.html";
    }

    @RequestMapping("/listDataGongcheng")
    @ResponseBody
    public LayuiPageInfo listDataGongcheng(MouldBoardMsg param){
        return mouldBoardMsgService.listDataGongcheng(param);
    }
}
